﻿using MathExpression;

namespace SimplexSolver
{
    /// <summary>
    /// Represents solution as line with two points
    /// </summary>
    public class DoubleSolution : ISolution
    {
        public IMathExpression Value { get; private set; }
        
        public IMathExpression[] Point1 { get; private set; }

        public IMathExpression[] Point2 { get; private set; }

        /// <summary>
        /// Create instance of solution as line with two points
        /// </summary>
        /// <param name="value">Result of target function</param>
        /// <param name="ps1">Point 1</param>
        /// <param name="ps2">Point 2</param>
        public DoubleSolution(IMathExpression value, IMathExpression[] ps1, IMathExpression[] ps2)
        {
            Value = value.Clone();
            Point1 = (IMathExpression[]) ps1.Clone();
            Point2 = (IMathExpression[]) ps2.Clone();
        }
        
        public ISolution Clone()
        {
            return new DoubleSolution(Value, Point1, Point2);
        }
    }
}